package com.gidgabs.modules.quartz;

import com.gidgabs.common.utils.HuanXinUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 环信更新token
 * Created by tby on 2018/7/6.
 */
@Component
public class HuanXinTask {

    @Autowired private HuanXinUtil huanXinUtil;
    private static final Logger LOGGER= LoggerFactory.getLogger(HuanXinTask.class);

    /**
     * 3天更新一次环信的token
     */
    @Scheduled(initialDelay = 1000,fixedDelay = 1000*60*60*24*3)
    public void refreshToken(){
        String token = huanXinUtil.obtainToken();
        LOGGER.info("获取到环信的token为: "+token);
    }
}
